#!/usr/bin/env python
# coding=utf-8
# @FileName :ssh.py
# @Time     :2023/4/10 17:50
# @Author   :ZXC
# @Desc     :
from typing import Optional

from pydantic import BaseModel, Field


class SSHTunnelObj(BaseModel):
    """
    SSH隧道对象模型
    """
    ssh_host: str = Field('127.0.0.1', description='堡垒机ip地址或主机名')
    ssh_port: int = Field(22, description='堡垒机连接mysql服务器的端口号，一般都是22，必须是数字')
    ssh_username: str = Field('root', description='堡垒机用户名')
    ssh_password: str = Field('123456', description='堡垒机用户密码')
    remote_bind_host: str = Field(..., description='远程主机地址')
    remote_bind_port: int = Field(..., description='远程主机端口')
    bind_local_address: bool = Field(False, description='是否指定本地地址和端口')
    local_bind_host: Optional[str] = Field(None, description='使用堡垒机的哪张网卡进行连接')
    local_bind_port: Optional[int] = Field(None, description='使用堡垒机的哪个端口进行连接')